//
//  ZZconstant.h
//  OCFrame
//
//  Created by hfzhangzhang on 2017/1/4.
//  Copyright © 2017年 hfzhangzhang. All rights reserved.
//

#ifndef ZZConstant_h
#define ZZConstant_h


//型号
#define kIS_IPHONE_X         (fabs((double)kScreen_Height - (double)(2436/3)) < DBL_EPSILON )


//尺寸

#define kScreenSize [UIScreen mainScreen].bounds.size
#define kScreen_Width [[UIScreen mainScreen] bounds].size.width
#define kScreen_Height [[UIScreen mainScreen] bounds].size.height

#define kHeight_NavBar  (kIS_IPHONE_X ? 88.f : 64.f)
#define kHeight_StatusBar (kIS_IPHONE_X ? 44.f : 20.f)
#define kHeight_TabBar (kIS_IPHONE_X ? (49.f+34.f) : 49.f)

//字号
#define kFONT(s)  [UIFont systemFontOfSize:s]


//颜色
#define kColorFromRGB(rgbValue)  [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
#define kColor_Theme kColorFromRGB(0xf04b49)
#define kColor_ThemeSelect kColorFromRGB(0xd4d442)
#define kColor_BackGround UIColorFromRGB(0xf4f4f4)//view基本背景色


//其他
#define kLog(xx, ...)  NSLog(@"\n---%s(第%d行)---\n" xx, __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)
#define kTipAlert(_S_, ...)     [[[UIAlertView alloc] initWithTitle:@"提示" message:[NSString stringWithFormat:(_S_), ##__VA_ARGS__] delegate:nil cancelButtonTitle:@"知道了" otherButtonTitles:nil] show]


//单例模式（温柔派）
#define ksingleH(_type_) + (_type_ *)sharedInstance;\
+(instancetype) alloc __attribute__((unavailable("call sharedInstance instead")));\
+(instancetype) new __attribute__((unavailable("call sharedInstance instead")));\
-(instancetype) copy __attribute__((unavailable("call sharedInstance instead")));\
-(instancetype) mutableCopy __attribute__((unavailable("call sharedInstance instead")));\

#define ksingleM(_type_) + (_type_ *)sharedInstance{\
static _type_ *theSharedInstance = nil;\
static dispatch_once_t onceToken;\
dispatch_once(&onceToken, ^{\
theSharedInstance = [[super alloc] init];\
});\
return theSharedInstance;\
}
#endif /* constant_h */
